--[[/**
-- * 
 * 远程友军援护
 * [0] cd时间 ,[1] 触发技能id
-- *
-- */]]

---@class BuffEffect63100 : BaseBuffEffect
BuffEffect63100 = ClientFight.CreateClass("BuffEffect63100", ClientFight.BaseBuffEffect)
local t = BuffEffect63100
local  BUFF_EFFECT_PARAMETERS = "EFFECT_PARAMETERS_BUFF_";
---@param fight Fight
---@param buff FighterBuff
function t:action(fight, buff, ...)

local parameters = {...};

 -- 援护者
 local fighter = buff.source;
 -- 被援护者
 local target = buff.target;
 --攻击者
 local trigger = parameters[1];

 local frame = fight.frame;
 -- 援护者是否已经死亡
 if (fighter:isDie()) then
 return IBuffEffect.REMOVE;
 end
 -- 援护者和被援护者是否为同一人
 if (fighter.fighterId == target.fighterId) then
 return IBuffEffect.REMOVE;
 end
 -- 被援护者非远程职业
 if (not target.isRangedCLass()) then
 return IBuffEffect.REMOVE;
 end

 -- 上一次触发时间是否在间隔以内
 local preFrameStr = fighter.paramemters[BUFF_EFFECT_PARAMETERS + buff.modelId];
 if (not string.isEmpty(preFrameStr)) then
 local preFrame = tonumber(preFrameStr);
 if (frame - preFrame < buff.buffBean.f_BuffEffectValue[1] / Global.FIGHT_FRAME) then
 return IBuffEffect.FAIL;
 end
 end

 SkillRoleMgr.savePathFile(string.format("[%s][EFFECT]Fighter:%s Buff:%s 触发远程友军援护",
 fight.frame, buff.target.fighterId, buff.modelId)
 );

 fighter.paramemters[BUFF_EFFECT_PARAMETERS + buff.modelId] =  tostring(frame);

 -- 触发技能
 ClientFight.BaseBuffEffect.triggerSkill(fight, fighter, target, buff.buffBean.f_BuffEffectValue[2]);
    return ClientFight.BaseBuffEffect.action(self, fight, buff, ...);
end

t.New()